using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._GeoAnalyticsServerTools._AnalyzePatterns
{
    /// <summary>
    /// <para>Geographically Weighted Regression </para>
    /// <para>Performs Geographically Weighted Regression (GWR), which is a local form of linear regression that is used to model spatially varying relationships.</para>
    /// <para>执行地理加权回归 （GWR），这是一种局部形式的线性回归，用于对空间变化的关系进行建模。</para>
    /// </summary>    
    [DisplayName("Geographically Weighted Regression ")]
    public class GWR : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GWR()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The point feature class containing the dependent and explanatory variables.</para>
        /// <para>包含因变量和解释变量的点要素类。</para>
        /// </param>
        /// <param name="_dependent_variable">
        /// <para>Dependent Variable</para>
        /// <para>The numeric field containing the observed values that will be modeled.</para>
        /// <para>包含将要建模的观测值的数值字段。</para>
        /// </param>
        /// <param name="_model_type">
        /// <para>Model Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of data that will be modeled.</para>
        ///   <bulletList>
        ///     <bullet_item>Continuous (Gaussian)— The Dependent Variable value is continuous. The Gaussian model will be used, and the tool performs ordinary least squares regression.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要建模的数据类型。</para>
        ///   <bulletList>
        ///     <bullet_item>连续（高斯）— 因变量值是连续的。将使用高斯模型，该工具执行普通最小二乘回归。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_explanatory_variables">
        /// <para>Explanatory Variable(s)</para>
        /// <para>A list of fields representing independent explanatory variables in the regression model.</para>
        /// <para>表示回归模型中独立解释变量的字段列表。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The name of the output feature service.</para>
        /// <para>输出要素服务的名称。</para>
        /// </param>
        /// <param name="_neighborhood_type">
        /// <para>Neighborhood Type</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the neighborhood used is constructed as a fixed distance or allowed to vary in spatial extent depending on the density of the features.</para>
        ///   <bulletList>
        ///     <bullet_item>Number of neighbors— The neighborhood size is a function of a specified number of neighbors included in calculations for each feature. Where features are dense, the spatial extent of the neighborhood is smaller; where features are sparse, the spatial extent of the neighborhood is larger.</bullet_item><para/>
        ///     <bullet_item>Distance band—The neighborhood size is a constant or fixed distance for each feature.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定所使用的邻域是构造为固定距离，还是允许根据要素的密度在空间范围内变化。</para>
        ///   <bulletList>
        ///     <bullet_item>邻域数 - 邻域大小是每个要素的计算中包含的指定数目邻域的函数。要素密集的地方，邻域的空间范围较小;要素稀疏的地方，邻域的空间范围较大。</bullet_item><para/>
        ///     <bullet_item>距离带 - 邻域大小是每个要素的常数或固定距离。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_neighborhood_selection_method">
        /// <para>Neighborhood Selection Method</para>
        /// <para><xdoc>
        ///   <para>Specifies how the neighborhood size will be determined.</para>
        ///   <bulletList>
        ///     <bullet_item>User defined— The neighborhood size will be determined by either the Number of Neighbors or Distance Band parameter.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何确定邻域大小。</para>
        ///   <bulletList>
        ///     <bullet_item>用户定义 — 邻域大小将由邻域数或距离波段参数确定。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public GWR(object _in_features, object _dependent_variable, _model_type_value _model_type, List<object> _explanatory_variables, object _output_features, _neighborhood_type_value? _neighborhood_type, _neighborhood_selection_method_value _neighborhood_selection_method)
        {
            this._in_features = _in_features;
            this._dependent_variable = _dependent_variable;
            this._model_type = _model_type;
            this._explanatory_variables = _explanatory_variables;
            this._output_features = _output_features;
            this._neighborhood_type = _neighborhood_type;
            this._neighborhood_selection_method = _neighborhood_selection_method;
        }
        public override string ToolboxName => "GeoAnalytics Server Tools";

        public override string ToolName => "Geographically Weighted Regression ";

        public override string CallName => "geoanalytics.GWR";

        public override List<string> AcceptEnvironments => ["extent", "outputCoordinateSystem", "workspace"];

        public override object[] ParameterInfo => [_in_features, _dependent_variable, _model_type.GetGPValue(), _explanatory_variables, _output_features, _neighborhood_type.GetGPValue(), _neighborhood_selection_method.GetGPValue(), _number_of_neighbors, _distance_band, _local_weighting_scheme.GetGPValue(), _data_store.GetGPValue(), _output];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The point feature class containing the dependent and explanatory variables.</para>
        /// <para>包含因变量和解释变量的点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Dependent Variable</para>
        /// <para>The numeric field containing the observed values that will be modeled.</para>
        /// <para>包含将要建模的观测值的数值字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Dependent Variable")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _dependent_variable { get; set; }


        /// <summary>
        /// <para>Model Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of data that will be modeled.</para>
        ///   <bulletList>
        ///     <bullet_item>Continuous (Gaussian)— The Dependent Variable value is continuous. The Gaussian model will be used, and the tool performs ordinary least squares regression.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要建模的数据类型。</para>
        ///   <bulletList>
        ///     <bullet_item>连续（高斯）— 因变量值是连续的。将使用高斯模型，该工具执行普通最小二乘回归。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _model_type_value _model_type { get; set; }

        public enum _model_type_value
        {
            /// <summary>
            /// <para>Continuous (Gaussian)</para>
            /// <para>Continuous (Gaussian)— The Dependent Variable value is continuous. The Gaussian model will be used, and the tool performs ordinary least squares regression.</para>
            /// <para>连续（高斯）— 因变量值是连续的。将使用高斯模型，该工具执行普通最小二乘回归。</para>
            /// </summary>
            [Description("Continuous (Gaussian)")]
            [GPEnumValue("CONTINUOUS")]
            _CONTINUOUS,

        }

        /// <summary>
        /// <para>Explanatory Variable(s)</para>
        /// <para>A list of fields representing independent explanatory variables in the regression model.</para>
        /// <para>表示回归模型中独立解释变量的字段列表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Variable(s)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _explanatory_variables { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The name of the output feature service.</para>
        /// <para>输出要素服务的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Neighborhood Type</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the neighborhood used is constructed as a fixed distance or allowed to vary in spatial extent depending on the density of the features.</para>
        ///   <bulletList>
        ///     <bullet_item>Number of neighbors— The neighborhood size is a function of a specified number of neighbors included in calculations for each feature. Where features are dense, the spatial extent of the neighborhood is smaller; where features are sparse, the spatial extent of the neighborhood is larger.</bullet_item><para/>
        ///     <bullet_item>Distance band—The neighborhood size is a constant or fixed distance for each feature.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定所使用的邻域是构造为固定距离，还是允许根据要素的密度在空间范围内变化。</para>
        ///   <bulletList>
        ///     <bullet_item>邻域数 - 邻域大小是每个要素的计算中包含的指定数目邻域的函数。要素密集的地方，邻域的空间范围较小;要素稀疏的地方，邻域的空间范围较大。</bullet_item><para/>
        ///     <bullet_item>距离带 - 邻域大小是每个要素的常数或固定距离。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Neighborhood Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _neighborhood_type_value? _neighborhood_type { get; set; }

        public enum _neighborhood_type_value
        {
            /// <summary>
            /// <para>Number of neighbors</para>
            /// <para>Number of neighbors— The neighborhood size is a function of a specified number of neighbors included in calculations for each feature. Where features are dense, the spatial extent of the neighborhood is smaller; where features are sparse, the spatial extent of the neighborhood is larger.</para>
            /// <para>邻域数 - 邻域大小是每个要素的计算中包含的指定数目邻域的函数。要素密集的地方，邻域的空间范围较小;要素稀疏的地方，邻域的空间范围较大。</para>
            /// </summary>
            [Description("Number of neighbors")]
            [GPEnumValue("NUMBER_OF_NEIGHBORS")]
            _NUMBER_OF_NEIGHBORS,

            /// <summary>
            /// <para>Distance band</para>
            /// <para>Distance band—The neighborhood size is a constant or fixed distance for each feature.</para>
            /// <para>距离带 - 邻域大小是每个要素的常数或固定距离。</para>
            /// </summary>
            [Description("Distance band")]
            [GPEnumValue("DISTANCE_BAND")]
            _DISTANCE_BAND,

        }

        /// <summary>
        /// <para>Neighborhood Selection Method</para>
        /// <para><xdoc>
        ///   <para>Specifies how the neighborhood size will be determined.</para>
        ///   <bulletList>
        ///     <bullet_item>User defined— The neighborhood size will be determined by either the Number of Neighbors or Distance Band parameter.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何确定邻域大小。</para>
        ///   <bulletList>
        ///     <bullet_item>用户定义 — 邻域大小将由邻域数或距离波段参数确定。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Neighborhood Selection Method")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _neighborhood_selection_method_value _neighborhood_selection_method { get; set; }

        public enum _neighborhood_selection_method_value
        {
            /// <summary>
            /// <para>User defined</para>
            /// <para>User defined— The neighborhood size will be determined by either the Number of Neighbors or Distance Band parameter.</para>
            /// <para>用户定义 — 邻域大小将由邻域数或距离波段参数确定。</para>
            /// </summary>
            [Description("User defined")]
            [GPEnumValue("USER_DEFINED")]
            _USER_DEFINED,

        }

        /// <summary>
        /// <para>Number of Neighbors</para>
        /// <para>The closest number of neighbors (up to 1000) to consider for each feature. The number must be an integer between 2 and 1000.</para>
        /// <para>每个要素要考虑的最接近的邻居数（最多 1000 个）。该数字必须是介于 2 和 1000 之间的整数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Neighbors")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _number_of_neighbors { get; set; } = null;


        /// <summary>
        /// <para>Distance Band</para>
        /// <para>The spatial extent of the neighborhood.</para>
        /// <para>邻域的空间范围。</para>
        /// <para>单位： Feet | Yards | Miles | NauticalMiles | Meters | Kilometers </para>
        /// </summary>
        [DisplayName("Distance Band")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _distance_band { get; set; } = null;


        /// <summary>
        /// <para>Local Weighting Scheme</para>
        /// <para><xdoc>
        ///   <para>Specifies the kernel type that will be used to provide the spatial weighting in the model. The kernel defines how each feature is related to other features within its neighborhood.</para>
        ///   <bulletList>
        ///     <bullet_item>Bisquare—A weight of 0 will be assigned to any feature outside the neighborhood specified. This is the default.</bullet_item><para/>
        ///     <bullet_item>Gaussian—All features will receive weights, but weights become exponentially smaller the farther away they are from the target feature.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于在模型中提供空间权重的核类型。内核定义每个特征如何与其邻域中的其他特征相关联。</para>
        ///   <bulletList>
        ///     <bullet_item>双正方形—权重 0 将分配给指定邻域之外的任何要素。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>高斯 - 所有要素都将接收权重，但权重与目标要素的距离越远，权重就会呈指数级变小。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Local Weighting Scheme")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _local_weighting_scheme_value _local_weighting_scheme { get; set; } = _local_weighting_scheme_value._BISQUARE;

        public enum _local_weighting_scheme_value
        {
            /// <summary>
            /// <para>Bisquare</para>
            /// <para>Bisquare—A weight of 0 will be assigned to any feature outside the neighborhood specified. This is the default.</para>
            /// <para>双正方形—权重 0 将分配给指定邻域之外的任何要素。这是默认设置。</para>
            /// </summary>
            [Description("Bisquare")]
            [GPEnumValue("BISQUARE")]
            _BISQUARE,

            /// <summary>
            /// <para>Gaussian</para>
            /// <para>Gaussian—All features will receive weights, but weights become exponentially smaller the farther away they are from the target feature.</para>
            /// <para>高斯 - 所有要素都将接收权重，但权重与目标要素的距离越远，权重就会呈指数级变小。</para>
            /// </summary>
            [Description("Gaussian")]
            [GPEnumValue("GAUSSIAN")]
            _GAUSSIAN,

        }

        /// <summary>
        /// <para>Data Store</para>
        /// <para><xdoc>
        ///   <para>Specifies the ArcGIS Data Store where the output will be saved. The default is Spatiotemporal big data store. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.</para>
        ///   <bulletList>
        ///     <bullet_item>Spatiotemporal big data store—Output will be stored in a spatiotemporal big data store. This is the default.</bullet_item><para/>
        ///     <bullet_item>Relational data store—Output will be stored in a relational data store.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将保存输出的 ArcGIS Data Store。默认值为 Spatiotemporal 大数据存储。存储在时空大数据存储中的所有结果都将存储在 WGS84 中。存储在关系数据存储中的结果将保留其坐标系。</para>
        ///   <bulletList>
        ///     <bullet_item>时空大数据存储 - 输出将存储在时空大数据存储中。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>关系数据存储 - 输出将存储在关系数据存储中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Data Store")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _data_store_value _data_store { get; set; } = _data_store_value._SPATIOTEMPORAL_DATA_STORE;

        public enum _data_store_value
        {
            /// <summary>
            /// <para>Relational data store</para>
            /// <para>Relational data store—Output will be stored in a relational data store.</para>
            /// <para>关系数据存储 - 输出将存储在关系数据存储中。</para>
            /// </summary>
            [Description("Relational data store")]
            [GPEnumValue("RELATIONAL_DATA_STORE")]
            _RELATIONAL_DATA_STORE,

            /// <summary>
            /// <para>Spatiotemporal big data store</para>
            /// <para>Spatiotemporal big data store—Output will be stored in a spatiotemporal big data store. This is the default.</para>
            /// <para>时空大数据存储 - 输出将存储在时空大数据存储中。这是默认设置。</para>
            /// </summary>
            [Description("Spatiotemporal big data store")]
            [GPEnumValue("SPATIOTEMPORAL_DATA_STORE")]
            _SPATIOTEMPORAL_DATA_STORE,

        }

        /// <summary>
        /// <para>Output</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output { get; set; }


        public GWR SetEnv(object extent = null, object outputCoordinateSystem = null, object workspace = null)
        {
            base.SetEnv(extent: extent, outputCoordinateSystem: outputCoordinateSystem, workspace: workspace);
            return this;
        }

    }

}